﻿using System;
using System.Configuration;

namespace NCommet.Core.Configuration
{
    /// <summary>
    /// A configuration element collection containing <see cref="NCommet.Core.Configuration.ModuleCfgElement" />
    /// </summary>
    public class ModuleCfgCollection : ConfigurationElementCollection
    {
        /// <summary>
        /// Creates a new <see cref="ModuleCfgElement" />
        /// </summary>
        /// <returns>A <see cref="ModuleCfgElement" /></returns>
        protected override ConfigurationElement CreateNewElement()
        {
            return new ModuleCfgElement();
        }

        /// <summary>
        /// Returns the <see cref="NCommet.Core.Configuration.ModuleCfgElement.Type" /> of the <see cref="NCommet.Core.Configuration.ModuleCfgElement" />        
        /// </summary>
        /// <param name="element">The <see cref="NCommet.Core.Configuration.ModuleCfgElement" /></param>
        /// <returns>The <see cref="NCommet.Core.Configuration.ModuleCfgElement.Type" /> of the <see cref="NCommet.Core.Configuration.ModuleCfgElement" /></returns>
        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((ModuleCfgElement)element).Type;
        }
    }
}
